import DataSetModel from './DataSetModel'
import BaseModel from './BaseModel'

export default class ErrorModel extends BaseModel {
  static type = 'error';
  errors = new DataSetModel();

  constructor(data = null) {
    super(data);
    if (data !== null) {
      this.model(data);
    }
  }

  * messages() {
    for (let errorItem of this.errors.dataSet()) {
      yield errorItem.message;
    }
  }

}
